{% load permission_tags %}

<div class="topnav">
  <div class="container-fluid">
    <nav class="navbar navbar-light navbar-expand-lg topnav-menu">
      <div class="collapse navbar-collapse" id="topnav-menu-content">
        <ul class="navbar-nav">
          <li class="nav-item dropdown {{target_data_active}}">
            <a class="nav-link arrow-none" href="{% url 'dashboardIndex' current_project.slug %}">
              <i class="fe-home me-1"></i> Dashboard
            </a>
          </li>
          <li class="nav-item dropdown {{target_data_active}}">
            <a class="nav-link arrow-none" href="{% url 'list_projects' current_project.slug %}">
              <i class="fe-folder me-1"></i> Projects
            </a>
          </li>
          <li class="nav-item dropdown {{target_data_active}}">
            <a class="nav-link arrow-none" href="{% url 'list_target' current_project.slug %}">
              <i class="fe-crosshair me-1"></i> Targets
            </a>
          </li>
          <li class="nav-item dropdown {{scan_history_active}} {{scheduled_scan_active}}">
            <a class="nav-link dropdown-toggle arrow-none" href="#" id="topnav-history" role="button"
              data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
              <i class="fe-activity me-1"></i> Scan History
              <div class="arrow-down"></div>
            </a>
            <div class="dropdown-menu" aria-labelledby="topnav-history">
              <a href="{% url 'scan_history' current_project.slug %}" class="dropdown-item">Scan History</a>
              <a href="{% url 'subscan_history' current_project.slug %}" class="dropdown-item">Sub Scan History</a>
              <a href="{% url 'scheduled_scan_view' current_project.slug %}" class="dropdown-item">Scheduled Scan</a>
              <div class="dropdown-divider"></div>
              <a href="{% url 'all_subdomains' current_project.slug %}" class="dropdown-item">All Subdomains</a>
              <a href="{% url 'all_endpoints' current_project.slug %}" class="dropdown-item">All Endpoints</a>
            </div>
          </li>
          <li class="nav-item dropdown">
            <a class="nav-link arrow-none" href="{% url 'all_vulns' current_project.slug %}">
              <i class="fe-alert-triangle me-1"></i> Vulnerabilities
            </a>
          </li>
          <li class="nav-item dropdown {{recon_note_active}}">
            <a class="nav-link arrow-none" href="{% url 'list_note' current_project.slug %}">
              <i class="fe-check-square me-1"></i> Todo
            </a>
          </li>
          <li class="nav-item dropdown {{organization_active}}">
            <a class="nav-link arrow-none" href="{% url 'list_organization' current_project.slug %}">
              <i class="fe-briefcase me-1"></i> Organization
            </a>
          </li>
          <li class="nav-item dropdown {{scan_engine_nav_active}}">
            <a class="nav-link dropdown-toggle arrow-none" href="#" id="topnav-scanengine" role="button"
              data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
              <i class="fe-cpu me-1"></i> Scan Engine
              <div class="arrow-down"></div>
            </a>
            <div class="dropdown-menu" aria-labelledby="topnav-scanengine">
              {% if user|can:'modify_scan_configurations' %}
              <a href="{% url 'scan_engine_index' current_project.slug %}" class="dropdown-item">Scan Engines</a>
              {% endif %}
              {% if user|can:'modify_wordlists' %}
              <a href="{% url 'wordlist_list' current_project.slug %}" class="dropdown-item">Wordlists</a>
              {% endif %}
              {% if user|can:'modify_interesting_lookup' %}
              <a href="{% url 'interesting_lookup' current_project.slug %}" class="dropdown-item">Interesting Lookup</a>
              {% endif %}
            </div>
          </li>
          {% if user_preferences.bug_bounty_mode %}
            <li class="nav-item dropdown {{bountyhub_active}}">
              <a class="nav-link dropdown-toggle arrow-none" href="#" id="topnav-bountyhub" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                <i class="fe-command me-1"></i> Bounty Hub
                <div class="arrow-down"></div>
              </a>
              <ul class="dropdown-menu" aria-labelledby="bountyHubDropdown">
                <li class="dropdown-item dropdown">
                  <a class="dropdown-toggle" href="#" id="hackerOneDropdown" data-bs-toggle="dropdown" aria-expanded="false">
                    HackerOne
                  </a>
                  <ul class="dropdown-menu" aria-labelledby="hackerOneDropdown">
                    <li><a class="dropdown-item" href="{% url 'list_bountyhub_programs' current_project.slug %}">
                      <i class="fe-life-buoy me-1"></i> Programs Dashboard
                    </a></li>
                    <li><a class="dropdown-item" href="#" onclick="handleSyncBookmarkedProgramsSwal()">
                      <i class="fe-refresh-cw me-1"></i> Sync Bookmarked Programs
                    </a></li>
                  </ul>
                </li>
              </ul>
            </li>
          {% endif %}
          <li class="nav-item dropdown {{settings_nav_active}}">
            <a class="nav-link dropdown-toggle arrow-none" href="#" id="topnav-settings" role="button"
              data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
              <i class="fe-settings me-1"></i> Settings
              <div class="arrow-down"></div>
            </a>
            <div class="dropdown-menu" aria-labelledby="topnav-settings">
              {% if user|can:'modify_scan_configurations' %}
              <a href="{% url 'proxy_settings' current_project.slug %}" class="dropdown-item">Proxies</a>
              <a href="{% url 'tool_settings' current_project.slug %}" class="dropdown-item">Tool Settings</a>
              {% endif %}
              {% if user|can:'modify_system_configurations' %}
              <a href="{% url 'api_vault' current_project.slug %}" class="dropdown-item">API Vault</a>
              <a href="{% url 'llm_toolkit' current_project.slug %}" class="dropdown-item">LLM Toolkit</a>
              <a href="{% url 'tool_arsenal' current_project.slug %}" class="dropdown-item">Tools Arsenal</a>
              {% endif %}
              {% if user|can:'modify_scan_report' %}
              <a href="{% url 'report_settings' current_project.slug %}" class="dropdown-item">Report Settings</a>
              {% endif %}
              {% if user|can:'modify_system_configurations' %}
              <a href="{% url 'rengine_settings' current_project.slug %}" class="dropdown-item">reNgine Settings</a>
              {% endif %}
              {% if user|can:'modify_scan_configurations' %}
                {% if user_preferences.bug_bounty_mode %}
                  <a href="{% url 'hackerone_settings' current_project.slug %}" class="dropdown-item">Hackerone Settings</a>
                {% endif %}
              <a href="{% url 'notification_settings' current_project.slug %}" class="dropdown-item">Notification Settings</a>
              {% endif %}
            </div>
          </li>
        </ul>
      </div>
      <span class="badge bg-blue" data-bs-toggle="tooltip" data-bs-placement="top" title="Current Project">{{current_project.name}}</span>
    </nav>
  </div>
</div>
